import React,{Component} from "react"
import "./style.css"


class ShopList extends Component{
    constructor(props){
        super(props)
        this.state = {
            editing: false,
            stars: props.data.stars || 0,
            comment:props.data.comment || '',
        }
    }

    render(){
        const {shop, product, price, picture, ifCommented} = this.props.data;
        return(
            <div className="OrderItem">
                <div className="orderItem_picContainer">
                    <img className="orderItem_pic" src={picture} alt=""/>
                </div>
                <div className="orderItem_content">
                    <div className="orderItem_product">{product}</div>
                    <div className="orderItem_shop">{shop}</div>
                    <div className="orderItem_detail">
                        <div className="orderItem_price">{price}</div>
                        <div>
                            {
                                ifCommented ? (
                                    <button className="orderItem_btn orderItem_btn_grey">
                                        已评价</button>
                                ) : (
                                    <button className="orderItem_btn orderItem_btn_red" onClick={this.handleOpenEidt.bind(this)}>
                                        评价</button>
                                )
                            }
                        </div>
                    </div>
                </div>
            </div>
        )
    }
    handleOpenEidt(){
        const item =this.props.data;
        this.props.gotoEva(item)
    }
}


export default ShopList